package cn.aitrox.ry.bean;

import cn.aitrox.ry.util.DicomUtils;
import com.google.common.base.Strings;
import org.dcm4che3.data.Attributes;
import org.dcm4che3.data.SpecificCharacterSet;


public class DicomFileAttributes {

    private static final Integer customizeAnonymizeTag = 2019627024;

    /**
     * 公有tag
     */
    private Attributes inFmi;

    /**
     * 私有tag
     */
    private Attributes inDs;

    /**
     * 需要特殊计算
     */
    private Integer fileMetaInformationGroupLength;

    private Boolean dsOnlyTag;

    public Attributes getInFmi() {
        return inFmi;
    }

    public void setInFmi(Attributes inFmi) {
        this.inFmi = inFmi;
    }

    public Attributes getInDs() {
        return inDs;
    }

    public void setInDs(Attributes inDs) {
        this.inDs = inDs;
    }

    public Integer getFileMetaInformationGroupLength() {
        return fileMetaInformationGroupLength;
    }

    public void setFileMetaInformationGroupLength(Integer fileMetaInformationGroupLength) {
        this.fileMetaInformationGroupLength = fileMetaInformationGroupLength;
    }

    public Boolean getDsOnlyTag() {
        return dsOnlyTag;
    }

    public void setDsOnlyTag(Boolean dsOnlyTag) {
        this.dsOnlyTag = dsOnlyTag;
    }

    public String getCustomizeAnonymizeTag() {
        return DicomUtils.getTagValue(customizeAnonymizeTag, this.inDs);
    }

    public SpecificCharacterSet getCharacterSet() {
        return this.inDs.getSpecificCharacterSet();
    }

    public String getManufacturerModelName() {
        return DicomUtils.getTagValue(528528, this.inDs);
    }

    public String getTransferSyntaxUID() {
        return DicomUtils.getTagValue(131088, this.inDs);
    }

    public String getPatientID() {
        return DicomUtils.getTagValue(1048608, this.inDs);
    }

    public String getPatientName() {
        return DicomUtils.getTagValue(1048592, this.inDs);
    }

    public String getPatientName(String encoding) {
        return DicomUtils.getTagValue(1048592, this.inDs);
    }

    public String getPatientAge() {
        return DicomUtils.getTagValue(1052688, this.inDs);
    }

    public String getPatientSex() {
        return DicomUtils.getTagValue(1048640, this.inDs);
    }

    public String getAccessionNumber() {
        return DicomUtils.getTagValue(524368, this.inDs);
    }

    public String getStudyDate() {
        return DicomUtils.getTagValue(524320, this.inDs);
    }

    public String getStudyTime() {
        return DicomUtils.getTagValue(524336, this.inDs);
    }

    public String getBirthDate() {
        return DicomUtils.getTagValue(1048624, this.inDs);
    }

    public String getStudyUID() {
        return DicomUtils.getTagValue(2097165, this.inDs);
    }

    public String getStudyID() {
        return DicomUtils.getTagValue(2097168, this.inDs);
    }

    public String getStudyDesc() {
        return DicomUtils.getTagValue(528432, this.inDs);
    }

    public String getSeriesUID() {
        return DicomUtils.getTagValue(2097166, this.inDs);
    }

    public Integer getSeriesDcmCount() {
        return stringToInteger(DicomUtils.getTagValue(2101769, this.inDs));
    }

    public Integer getSeriesNum() {
        return stringToInteger(DicomUtils.getTagValue(2097169, this.inDs));
    }

    public Integer getDcmNum() {
        return stringToInteger(DicomUtils.getTagValue(2097171, this.inDs));
    }

    public String getModality() {
        return DicomUtils.getTagValue(524384, this.inDs);
    }

    public String getBodyPart() {
        return DicomUtils.getTagValue(1572885, this.inDs);
    }

    public String getSliceThickness() {
        return DicomUtils.getTagValue(1572944, this.inDs);
    }

    public String getKVP() {
        return DicomUtils.getTagValue(1572960, this.inDs);
    }

    public String getKernel() {
        return DicomUtils.getTagValue(1577488, this.inDs);
    }

    public String getDeviceProcessingCode() {
        return DicomUtils.getTagValue(1577985, this.inDs);
    }

    public String getDeviceProcessingDesc() {
        return DicomUtils.getTagValue(1577984, this.inDs);
    }

    public String getPatientOrientation() {
        return DicomUtils.getTagValue(2097184, this.inDs);
    }

    public String getPatientPosition() {
        return DicomUtils.getTagValue(1593600, this.inDs);
    }

    public String getImageOrientation() {
        return DicomUtils.getTagValue(2097207, this.inDs);
    }

    public String getRows() {
        return DicomUtils.getTagValue(2621456, this.inDs);
    }

    public String getColumns() {
        return DicomUtils.getTagValue(2621457, this.inDs);
    }

    public String getProtocolName() {
        return DicomUtils.getTagValue(1577008, this.inDs);
    }

    public String getFileMetaInformationVersion() {
        return DicomUtils.getTagValue(131073, this.inDs);
    }

    public String getMediaStorageSOPClassUID() {
        return DicomUtils.getTagValue(131074, this.inDs);
    }

    public String getMediaStorageSOPInstanceUID() {
        return DicomUtils.getTagValue(131075, this.inDs);
    }

    public String getImplementationClassUID() {
        return DicomUtils.getTagValue(131090, this.inDs);
    }

    public String getImplementationVersionName() {
        return DicomUtils.getTagValue(131091, this.inDs);
    }

    public String getSourceApplicationEntityTitle() {
        return DicomUtils.getTagValue(131094, this.inDs);
    }

    public String getSpecificCharacterSet() {
        return DicomUtils.getTagValue(524293, this.inDs);
    }

    public String getInstanceCreationDate() {
        return DicomUtils.getTagValue(524306, this.inDs);
    }

    public String getInstanceCreationTime() {
        return DicomUtils.getTagValue(524307, this.inDs);
    }

    public String getSOPClassUID() {
        return DicomUtils.getTagValue(524310, this.inDs);
    }

    public String getAcquisitionDate() {
        return DicomUtils.getTagValue(524322, this.inDs);
    }

    public String getContentDate() {
        return DicomUtils.getTagValue(524323, this.inDs);
    }

    public String getAcquisitionDateTime() {
        return DicomUtils.getTagValue(524330, this.inDs);
    }

    public String getAcquisitionTime() {
        return DicomUtils.getTagValue(524338, this.inDs);
    }

    public String getContentTime() {
        return DicomUtils.getTagValue(524339, this.inDs);
    }

    public String getManufacturer() {
        return DicomUtils.getTagValue(524400, this.inDs);
    }

    public String getInstitutionName() {
        return DicomUtils.getTagValue(524416, this.inDs);
    }

    public String getInstitutionAddress() {
        return DicomUtils.getTagValue(524417, this.inDs);
    }

    public String getReferringPhysicianName() {
        return DicomUtils.getTagValue(524432, this.inDs);
    }

    public String getStationName() {
        return DicomUtils.getTagValue(528400, this.inDs);
    }

    public String getStudyDescription() {
        return DicomUtils.getTagValue(528432, this.inDs);
    }

    public String getInstitutionalDepartmentName() {
        return DicomUtils.getTagValue(528448, this.inDs);
    }

    public String getOperatorsName() {
        return DicomUtils.getTagValue(528496, this.inDs);
    }

    public String getIssuerOfPatientID() {
        return DicomUtils.getTagValue(1048609, this.inDs);
    }

    public String getPatientBirthDate() {
        return DicomUtils.getTagValue(1048624, this.inDs);
    }

    public String getOtherPatientIDs() {
        return DicomUtils.getTagValue(1052672, this.inDs);
    }

    public String getPatientWeight() {
        return DicomUtils.getTagValue(1052720, this.inDs);
    }

    public String getPatientAddress() {
        return DicomUtils.getTagValue(1052736, this.inDs);
    }

    public String getMedicalAlerts() {
        return DicomUtils.getTagValue(1056768, this.inDs);
    }

    public String getAllergies() {
        return DicomUtils.getTagValue(1057040, this.inDs);
    }

    public String getEthnicGroup() {
        return DicomUtils.getTagValue(1057120, this.inDs);
    }

    public String getAdditionalPatientHistory() {
        return DicomUtils.getTagValue(1057200, this.inDs);
    }

    public String getPregnancyStatus() {
        return DicomUtils.getTagValue(1057216, this.inDs);
    }

    public String getPatientComments() {
        return DicomUtils.getTagValue(1064960, this.inDs);
    }

    public String getScanOptions() {
        return DicomUtils.getTagValue(1572898, this.inDs);
    }

    public String getSpacingBetweenSlices() {
        return DicomUtils.getTagValue(1573000, this.inDs);
    }

    public String getDataCollectionDiameter() {
        return DicomUtils.getTagValue(1573008, this.inDs);
    }

    public String getSoftwareVersions() {
        return DicomUtils.getTagValue(1576992, this.inDs);
    }

    public String getGantryDetectorTilt() {
        return DicomUtils.getTagValue(1577248, this.inDs);
    }

    public String getTableHeight() {
        return DicomUtils.getTagValue(1577264, this.inDs);
    }

    public String getRotationDirection() {
        return DicomUtils.getTagValue(1577280, this.inDs);
    }

    public String getExposureTime() {
        return DicomUtils.getTagValue(1577296, this.inDs);
    }

    public String getExposure() {
        return DicomUtils.getTagValue(1577298, this.inDs);
    }

    public String getFilterType() {
        return DicomUtils.getTagValue(1577312, this.inDs);
    }

    public String getExposureModulationType() {
        return DicomUtils.getTagValue(1610531, this.inDs);
    }

    public String getEstimatedDoseSaving() {
        return DicomUtils.getTagValue(1610532, this.inDs);
    }

    public String getAcquisitionNumber() {
        return DicomUtils.getTagValue(2097170, this.inDs);
    }

    public String getInstanceNumber() {
        return DicomUtils.getTagValue(2097171, this.inDs);
    }

    public String getFrameOfReferenceUID() {
        return DicomUtils.getTagValue(2097234, this.inDs);
    }

    public String getLaterality() {
        return DicomUtils.getTagValue(2097248, this.inDs);
    }

    public String getPositionReferenceIndicator() {
        return DicomUtils.getTagValue(2101312, this.inDs);
    }

    public String getImageComments() {
        return DicomUtils.getTagValue(2113536, this.inDs);
    }

    public String getRequestingService() {
        return DicomUtils.getTagValue(3280947, this.inDs);
    }

    public String getRequestedProcedureDescription() {
        return DicomUtils.getTagValue(3280992, this.inDs);
    }

    public String getRequestedContrastAgent() {
        return DicomUtils.getTagValue(3281008, this.inDs);
    }

    public String getAdmissionID() {
        return DicomUtils.getTagValue(3670032, this.inDs);
    }

    public String getSpecialNeeds() {
        return DicomUtils.getTagValue(3670096, this.inDs);
    }

    public String getPatientState() {
        return DicomUtils.getTagValue(3671296, this.inDs);
    }

    public String getPreMedication() {
        return DicomUtils.getTagValue(4194322, this.inDs);
    }

    public String getPerformedProcedureStepID() {
        return DicomUtils.getTagValue(4194899, this.inDs);
    }

    public String getPerformedProcedureStepDescription() {
        return DicomUtils.getTagValue(4194900, this.inDs);
    }

    public String getFillerOrderNumberImagingServiceRequest() {
        return DicomUtils.getTagValue(4202519, this.inDs);
    }

    public String getConfidentialityConstraintOnPatientDataDescription() {
        return DicomUtils.getTagValue(4206593, this.inDs);
    }

    public String getSeriesDate() {
        return DicomUtils.getTagValue(524321, this.inDs);
    }

    public String getSeriesTime() {
        return DicomUtils.getTagValue(524337, this.inDs);
    }

    public String getAcquiredImageAreaDoseProduct() {
        return DicomUtils.getTagValue(1610867, this.inDs);
    }

    public String getFocalSpots() {
        return DicomUtils.getTagValue(1577360, this.inDs);
    }

    public String getSpiralPitchFactor() {
        return DicomUtils.getTagValue(1610513, this.inDs);
    }

    public String getCTDIvol() {
        return DicomUtils.getTagValue(1610565, this.inDs);
    }

    public String getDetectorType() {
        return DicomUtils.getTagValue(1601540, this.inDs);
    }

    public String getSeriesDescription() {
        return DicomUtils.getTagValue(528446, this.inDs);
    }

    public String getWindowCenter() {
        return DicomUtils.getTagValue(2625616, this.inDs);
    }

    public String getWindowWidth() {
        return DicomUtils.getTagValue(2625617, this.inDs);
    }

    public String getBitsAllocated() {
        return DicomUtils.getTagValue(2621696, this.inDs);
    }

    public String getBitsStored() {
        return DicomUtils.getTagValue(2621697, this.inDs);
    }

    public String getHighBit() {
        return DicomUtils.getTagValue(2621698, this.inDs);
    }

    public String getPixelRepresentation() {
        return DicomUtils.getTagValue(2621699, this.inDs);
    }

    public String getRescaleIntercept() {
        return DicomUtils.getTagValue(2625618, this.inDs);
    }

    public String getRescaleSlope() {
        return DicomUtils.getTagValue(2625619, this.inDs);
    }

    public String getSOPInstanceUID() {
        return DicomUtils.getTagValue(524312, this.inDs);
    }

    public String getImagePositionPatient() {
        return DicomUtils.getTagValue(2097202, this.inDs);
    }

    public String getDistanceSourceToPatient() {
        return DicomUtils.getTagValue(1577233, this.inDs);
    }

    public String getDistanceSourceToDetector() {
        return DicomUtils.getTagValue(1577232, this.inDs);
    }

    public String getRescaleType() {
        return DicomUtils.getTagValue(2625620, this.inDs);
    }

    public String getImageType() {
        return DicomUtils.getTagValue(524296, this.inDs);
    }

    public String getViewPosition() {
        return DicomUtils.getTagValue(1593601, this.inDs);
    }

    public String getXRayTubeCurrent() {
        return DicomUtils.getTagValue(1577297, this.inDs);
    }

    public String getReconstructionDiameter() {
        return DicomUtils.getTagValue(1577216, this.inDs);
    }

    public String getSamplesPerPixel() {
        return DicomUtils.getTagValue(2621442, this.inDs);
    }

    public String getPhotometricInterpretation() {
        return DicomUtils.getTagValue(2621444, this.inDs);
    }

    public String getSliceLocation() {
        return DicomUtils.getTagValue(2101313, this.inDs);
    }

    public Integer getNumberOfFrames() {
        String tagValue = DicomUtils.getTagValue(2621448, this.inDs);
        return null == tagValue ? null : Integer.parseInt(tagValue);
    }

    public Integer getRecommendedDisplayFrameRate() {
        String tagValue = DicomUtils.getTagValue(532804, this.inDs);
        return null == tagValue ? null : Integer.parseInt(tagValue);
    }

    public Integer getActualFrameDuration() {
        String tagValue = DicomUtils.getTagValue(1577538, this.inDs);
        return null == tagValue ? null : Integer.parseInt(tagValue);
    }

    public Float getFrameTime() {
        String tagValue = DicomUtils.getTagValue(1577059, this.inDs);
        return null == tagValue ? null : Float.parseFloat(tagValue);
    }

    public Float getFrameDelay() {
        String tagValue = DicomUtils.getTagValue(1577062, this.inDs);
        return null == tagValue ? null : Float.parseFloat(tagValue);
    }

    public String getWindowCenterX() {
        return this.getWindowCenter(0);
    }

    public String getWindowCenterY() {
        return this.getWindowCenter(1);
    }

    public String getWindowWidthX() {
        return this.getWindowWidth(0);
    }

    public String getWindowWidthY() {
        return this.getWindowWidth(1);
    }

    private String getWindowWidth(int index) {
        return this.inDs.getString(2625617, index, "");
    }

    private String getWindowCenter(int index) {
        return this.inDs.getString(2625616, index, "");
    }

    private Integer stringToInteger(String val) {
        if (Strings.isNullOrEmpty(val)) {
            return null;
        } else {
            try {
                return Integer.valueOf(val);
            } catch (Exception var2) {
                return null;
            }
        }
    }
}
